package com.example.utils;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * @descriptions:
 * @author:
 * @date: 2022/7/19 20:45
 */
public interface MyPageHelper {
    public static void StartPage(PageRequest pageRequest){
        PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getPageSize());
    }
    public static PageResult getPageResult(List content){
        PageInfo pageInfo = new PageInfo(content);
        PageResult pageResult = new PageResult();
        pageResult.setTotal(pageInfo.getTotal());
        pageResult.setContent(pageInfo.getList());
        pageResult.setPages(pageInfo.getPages());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setPageNum(pageInfo.getPageNum());
        return pageResult;
    }
}
